<?php
define('ADODB_DIR','/var/www/adodb');
require_once ('/var/www/adodb/adodb.inc.php');

function conex_hel(){
   $conn_hel	= ADONewConnection('oci8');
   $cstr	= "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.181.23.146)(PORT = 1528)))";
   $cstr	.= "(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME = gestionredes)))";
   $conn_hel->Connect($cstr, 'helusr', 'helusr');
   return $conn_hel;
}

function desconex_hel($conn_hel){
   $conn_hel->Close();
}

function getOperatorInfo($MSC_NUMBER){
	$helRst	= array();
	$qry	= "SELECT pais, operador, central FROM hel.operadores WHERE codigo_op = '".$MSC_NUMBER."'";
	$hel	= conex_hel();
	$rs	= $hel->Execute($qry);
	while (!$rs->EOF){
		$helRst['country']	= $rs->fields[0];
		$helRst['operator']	= $rs->fields[1];
		$helRst['central']	= $rs->fields[2];
		$rs->MoveNext();
	}
	desconex_hel($hel);
	return $helRst;
}

/*
$MSC_NUMBER     = "5691600031";
$operatorArr	= getOperatorInfo($MSC_NUMBER);
var_dump($operatorArr);
*/
?>
